package com.ciwong.epaper.modules.me.ui;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.ciwong.epaper.R;
import com.ciwong.epaper.modules.me.bean.Price;
import com.ciwong.epaper.modules.me.bean.Service;
import com.ciwong.epaper.modules.me.bean.Trial;

import java.util.List;

/**
 * Created by Administrator on 2018/1/17.
 */

public class NewPriceView extends LinearLayout {
    private List<Price> priceList;
    private Service service;
    private Trial trial = null;
    private Price price;
    private Price curPrice=null;
    private boolean isTrial=false;
    private boolean isfree=false;
    private NewBuyServicePriceAdapter.OnPriceClick onPriceClick;
    private Context context;
    private int curSelectPosition=0;

    public NewPriceView(Context context, List<Price> priceList, Service service, Trial trial) {
        super(context);
        this.context=context;
        this.priceList=priceList;
        this.service=service;
        this.trial=trial;
        init();
    }

    public NewPriceView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public NewPriceView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    private void init(){
        setOrientation(HORIZONTAL);
        removeAllViews();
        if (null != trial && trial.getTrlalcount() == 0 && trial.getTrlalsum() > 0 && service.getSign() != 3) {
            //显示免费体验按钮
            View view=LayoutInflater.from(this.getContext()).inflate(R.layout.item_price_mouth, null);
            isTrial=true;
            addView(view);
        }
        View view=LayoutInflater.from(this.getContext()).inflate(R.layout.item_price_mouth, null);
        TextView textView =new TextView(this.getContext());
        LayoutParams layoutParams=new LayoutParams(100,100);
        textView.setLayoutParams(layoutParams);
        TextView textView1 =new TextView(this.getContext());
        textView.setLayoutParams(layoutParams);
        TextView textView2 =new TextView(this.getContext());

        textView.setLayoutParams(layoutParams);
        isTrial=true;
        addView(view);
        addView(textView);
        View view1=LayoutInflater.from(this.getContext()).inflate(R.layout.item_price_mouth, null);
        isTrial=true;
        addView(view1);
        addView(textView1);
        View view2=LayoutInflater.from(this.getContext()).inflate(R.layout.item_price_mouth, null);
        isTrial=true;
        addView(view2);
        addView(textView2);
        View view3=LayoutInflater.from(this.getContext()).inflate(R.layout.item_price_mouth, null);
        isTrial=true;
        addView(view3);



    }




}
